package com.beep.erp.model.transfer.pallet;

import com.beep.erp.common.base.BaseBean;
import com.beep.erp.common.bean.BizStorageLocationsListBean;
import com.beep.erp.common.bean.GoodsDetailBean;
import com.beep.erp.common.bean.PalletGoodsBean;
import com.beep.erp.http.HttpRetrofit;
import com.beep.erp.http.RetryWhenNetworkException;
import com.beep.erp.model.goodsdetail.GoodsDetailContract;

import rx.Observable;

/**
 * Created by Jolly on 2018/8/2.
 */

public class PalletGoodsModel implements PalletGoodsContract.Model {
    @Override
    public Observable<PalletGoodsBean> getPalletGoodsDetail(String sign, String timeStamp, String name) {
        return HttpRetrofit.getInstance().apiService.getPalletGoodsDetail(sign, timeStamp, name).compose(HttpRetrofit.toSubscribe()).compose(HttpRetrofit.toTransformer()).retryWhen(new RetryWhenNetworkException());
    }

    @Override
    public Observable<BaseBean> movePosition(String sign, String timeStamp, String userId, String barcodeId, String goodsId, String number, String storageLocationIdFront, String storageLocationIdAfter) {
        return HttpRetrofit.getInstance().apiService.movePosition(sign, timeStamp, userId, barcodeId, goodsId, number, storageLocationIdFront, storageLocationIdAfter).compose(HttpRetrofit.toSubscribe()).compose(HttpRetrofit.toTransformer()).retryWhen(new RetryWhenNetworkException());
    }

    @Override
    public Observable<BizStorageLocationsListBean> getBizStorageLocationList(String sign, String timeStamp, String type) {
        return HttpRetrofit.getInstance().apiService.getBizStorageLocationList(sign, timeStamp, type).compose(HttpRetrofit.toSubscribe()).compose(HttpRetrofit.toTransformer()).retryWhen(new RetryWhenNetworkException());
    }

    @Override
    public Observable<BaseBean> saveEarlyStoge(String sign, String timeStamp, String barcode, String goodsCode, String number, String typeInfo, String userId, String manufactureDate, String storageLocationId) {
        return HttpRetrofit.getInstance().apiService.saveEarlyStage(sign, timeStamp, barcode, goodsCode, number, typeInfo, userId, manufactureDate, storageLocationId).compose(HttpRetrofit.toSubscribe()).compose(HttpRetrofit.toTransformer()).retryWhen(new RetryWhenNetworkException());
    }
}
